ahngbeom

ahngbeom

My Journey as a Developer

GitHub
Back to list

어댑터 패턴 설계

2025-09-01 · Back-End > 결제 서비스 MSA 아키텍쳐 전환

Spring Boot 3.4.0Java 21MySQL 8JPA
public interface PaymentPort {

  // 결제 요청 
  PaymentResponse payment(PaymentRequest payload, PaymentAdapterRunnable<BaseResponse> runnable);

  // 결제 조회
  ReadResponse read(ReadRequest payload);

  // 환불 요청
  RefundResponse refund(RefundRequest payload, PaymentAdapterRunnable<RefundResponse> runnable);

  // 결제 청구서 카카오톡 전송
  KakaoTalkResponse sendBill(TalkRequest payload, PaymentAdapterRunnable<KakaoTalkResponse> runnable);

  // 결제 청구서 파기
  DestroyResponse destroy(
      DestroyRequest payload, PaymentAdapterRunnable<DestroyResponse> successRunnable);

  // 결제 요청 결과 Callback
  default PaymentCallbackResponse callback(PaymentCallbackRequest payload, String hash) {
    return null;
  }
}